package com.jiangxfei.mymvp.app.home.module;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;

import com.jiangxfei.mymvp.R;
import com.jiangxfei.mymvp.app.home.adapter.RecyLoadAdapter;
import com.jiangxfei.mymvp.app.home.bean.User;
import com.jiangxfei.mymvp.app.home.mvp.HomeConstract;
import com.jiangxfei.mymvp.app.home.mvp.HomeModel;
import com.jiangxfei.mymvp.di.ActivityScope;
import com.jiangxfei.mymvp.net.RepositoryManager;

import java.util.ArrayList;
import java.util.List;

import dagger.Module;
import dagger.Provides;

@Module
public class HomeActivityModule {
    private HomeConstract.View loadAllView;

    public HomeActivityModule(HomeConstract.View loadAllView) {
        this.loadAllView = loadAllView;
    }

    @ActivityScope
    @Provides
    public HomeConstract.View providerLoadAllView() {
        return loadAllView;
    }



    @ActivityScope
    @Provides
    HomeConstract.Model providerLoadAllModel(RepositoryManager repositoryManager) {
        return new HomeModel(repositoryManager);
    }


    @ActivityScope
    @Provides
    List<User> providerUserList() {
        return new ArrayList<>();
    }

    @ActivityScope
    @Provides
    RecyLoadAdapter providerUserAdapter(List<User> userList) {
        return new RecyLoadAdapter(R.layout.item_user, userList);
    }

    @ActivityScope
    @Provides
    GridLayoutManager providerGridLayoutManager(Context context) {
        return new GridLayoutManager(context, 2);
    }
}
